﻿using System;
using System.Collections.Generic;
using System.Reflection;
using System.Text;
using NUnit.Core;

namespace JacketEmblem.Crane.UnitTests.NUnitExtensions
{
    public class DataFileTestCase : NUnitTestMethod
    {
        private object[] testCaseArguments;

        public DataFileTestCase(MethodInfo method, string testName, object[] arguments)
            : base(method)
        {
            testCaseArguments = arguments;
            this.TestName.Name = testName;
            this.TestName.FullName = testName;
        }

        public override void RunTestMethod(TestCaseResult testResult)
        {
            object[] arguments = testCaseArguments != null ? testCaseArguments : new object[] { null };
            Reflect.InvokeMethod(this.Method, this.Fixture, arguments);
        }
    }
}
